<?php
require('config.php');

        $user_id=$_REQUEST['user_id'];
        $orderId=$_REQUEST['orderId'];
        $status=$_REQUEST['status'];
		$sql="update ".$oto."_orders set orderStatus='{$status}' where userId='{$user_id}' and orderId='{$orderId}'";
		$result=$db->query($sql);
		if($status=='4' || $status==4)
		{
			$time=date('Y-m-d H:i:s');
			$sql="update ".$oto."_orders set confirmTime='{$time}' where userId='{$user_id}' and orderId='{$orderId}'";
			$result=$db->query($sql);
			$sql="SELECT shopId,needPay,commission FROM ".$oto."_orders where orderId='{$orderId}' ";
			$result=$db->query($sql);
			while($row=$result->fetch_assoc()){
				$orders[]=$row;//将取得的所有数据赋值给person_info数组
			}
			$shopId=$orders[0]['shopId'];
			if(isset($orders))
			{
				$jia=$orders[0]['needPay']-$orders[0]['commission'];
			}
			else
			{
				$jia=0;
			}
			$sql="update ".$oto."_shops set bizMoney=bizMoney+'$jia' where shopId='{$shopId}'";
			$result=$db->query($sql);
		}
		echo json_encode($result);
?>